package event.motor

import ext.arg

class ScanStatusChangedEvent(val raw: ByteArray) : MotorCode() {
    val col = raw.arg(1)
    val row = raw.arg(2)
    val state = raw.arg(3)

    fun barCode(): String {
        if (state != OK) {
            throw Exception("没有条码")
        }
        val code = ByteArray(raw.size - 8)
        System.arraycopy(raw, 6, code, 0, code.size)
        return String(code)
    }
}